<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function fn() {
            console.log(this);
            let fun = () => {
                console.log(this);//window
            }
            // fun()
        }

        //普通函数调用
        fn()//this指向window

        //对象方法调用
        let obj = {
            eat: fn
        }
        // obj.eat()//this指向对象

        //构造函数调用
        new fn()//this指向new创建的实例对象


    </script>
</body>

</html>